package com.learn.wiki.controller;

import com.learn.wiki.service.TestService;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;


//@Controller 返回页面
@RestController  //返回字符串
public class TestController {

    @Value("${test.hello:TEST}")
    private String testHello;

    @Resource
    private TestService testService;

    /**
     * GET,POST,PUT,DELETE.
     * <p>
     * /user?id=1
     * /user/1
     *
     * @return test
     */
//    @PostMapping
//    @DeleteMapping
//    @PutMapping
//    @RequestMapping(value = "/hello",method = RequestMethod.GET)
    @GetMapping("/hello")
    public String hello() {
        return "hello world" + testHello;
    }

    @PostMapping("/hello/post")
    public String helloPost(String name) {
        return "hello world Post," + name;
    }

//    @GetMapping("/test/list")
//    public List<Test> list() {
//        return testService.list();
//    }
}
